﻿<views:NewsReaderPage
    x:Class="NewsReaderApp.Views.Portrait"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NewsReaderApp"
    xmlns:views="using:NewsReaderApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Border BorderBrush="DarkGray" BorderThickness="2">
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <Grid.RowDefinitions>
                <RowDefinition Height="46" />
                <RowDefinition Height="92" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="255"/>
                <ColumnDefinition Width="255"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" 
                        Grid.ColumnSpan="3" HorizontalAlignment="Right" Width="230">
                <TextBlock Text="{StaticResource AppName}" 
                       Style="{StaticResource BasicTextStyle}"
                       Margin="3" 
                       VerticalAlignment="Center"
                       FontSize="30"/>
            </StackPanel>
            <ComboBox Grid.Row="0" Margin="3"
                IsTabStop="False" TabNavigation="Once"
                ItemTemplate="{StaticResource FeedItemTemplateLandscape}" SelectedItem="{Binding SelectedFeed, Mode=TwoWay}"
                ItemsSource="{Binding Feeds, Mode=TwoWay}">
            </ComboBox>
            <ComboBox Grid.Row="0" Grid.Column="1" Margin="3"
                ItemsSource="{Binding SelectedFeed.FeedItems}" 
                SelectedItem="{Binding SelectedFeed.SelectedItem, Mode=TwoWay}"
                ItemTemplate="{StaticResource NewsItemTemplateLandscape}">
            </ComboBox>
            <Grid  Grid.Row="1" Grid.ColumnSpan="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MaxWidth="102"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Border HorizontalAlignment="Left" BorderThickness="0" 
                    Visibility="{Binding Path=SelectedFeed.SelectedItem.ImageUriExists, Converter={StaticResource boolToVis}}">
                    <Image Source="{Binding SelectedFeed.SelectedItem.ImageUri}" Stretch="Uniform" Margin="1" Width="100"/>
                </Border>
                <TextBlock Grid.Column="1" VerticalAlignment="Center"
                       Style="{StaticResource BasicTextStyle}"
                       TextWrapping="Wrap"
                       Text="{Binding Path=SelectedFeed.SelectedItem.Title}" 
                       FontSize="30" 
                       Margin="2" 
                       />
            </Grid>

            <Grid Grid.ColumnSpan="3"  Grid.Row="2" 
              Margin="2,0,2,0" DataContext="{Binding SelectedFeed.SelectedItem}">
                <TextBlock  x:Name="ft" Text="{Binding Path=FullText}" Width="0" Height="0" />
                <ScrollViewer Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                                HorizontalScrollBarVisibility="Disabled" 
                              VerticalScrollBarVisibility="Auto"
                              Grid.Row="1" x:Name="contentView" x:FieldModifier="internal"/>
            </Grid>
        </Grid>
    </Border>
</views:NewsReaderPage>